<%@page import="com.web.entity.Teacher"%>
<%@page import="com.web.entity.TestBiao"%>
<%@page import="java.util.List"%>
<%@page errorPage="ApplyTestError.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <body>
        <div id="navdiv">
            <div class="top_navdiv">
                <div class="top_left">教师中心</div>
                <div class="identity">
                    <span>您好</span>
                    <div class="user_li">
                        <canvas id="myCanvas" width="100" height="30">
                        </canvas>
                    </div>
                </div>
            </div>
        </div>
        <div class="navbar  control_nav" >
            <div class="container"  style="margin-left: 300px; ">
                <ul class="nav navbar-nav navul">
                    <li class="col-md-2">
                        <a href="teacherApplyTest.jsp">申请/取消考试</a>
                    </li>
                    <li class="col-md-2">
                        <input type="hidden" name="ClassID" class="form-control" >
                        <a href="ssls">查看班级列表</a>
                    </li>
                    <li class="col-md-2">
                        <a href="SearchOneStudent.html">查询单个学生</a>
                    </li>
                    <li class="col-md-2">
                        <a href="sosgs">查询学生成绩</a>
                    </li>
                    <li class="col-md-2">
                        <a href="scgs">查询班级成绩</a>
                    </li>
                </ul>
            </div>
        </div>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Teacher Apply Test</title>
        <link rel="stylesheet" href="css/bootstrap.min.css"/>
        <link rel="stylesheet" href="css/newcss1.css">
        <link rel="stylesheet" href="css/mycss_foradim.css"/>
        <script src="js/jquery-3.4.1.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script src="js/script.js" charset="UTF-8"></script>
        <script type="text/javascript" src="js/circle.js" charset="UTF-8"></script>
    </head>
    <script type="text/javascript">
$(document).ready(function () {
    //点击提交考试，到ApplyTestServlet,提交考试信息
    $("#btn_addtest").click(function(){
        $.ajax({
            url:"atss",
            type:"POST",
            data: $("#addTest_form").serialize(),
            success: function(rows){
                if(rows!=1){
                    alert("添加失败，请确保考试信息没有申请过");
                    return;
                }
                var str="<tr id=\"tr"+$("#addTest_form #testid").val()+"\">"
                        +"<td>"+$("#addTest_form #testid").val()+"</td>"
                        +"<td>"+$("#addTest_form #tid").val()+"</td>"
                        +"<td>"+$("#addTest_form #testtime").val()+"</td>"
                        +"<td>"+$("#addTest_form #courseid").val()+"</td>"
                        +"<td>"+$("#addTest_form #classid").val()+"</td>"
                        +"<td>"+$("#addTest_form #istestfinish").val()+"</td>"
                        +"<td>"
                        +"<a href=\"javascript:deleteTest('"+$("#addTest_form #testid").val()+"');\">取消申请</a>"
                        +"</td>"
                        +"</tr>";
                alert("提交成功！");
                $("#dataTable").append(str);
            },
            error: function(){
                alert("请求处理出错，添加失败！");
            }
        });
    });
});

</script>
      <%
            Teacher t = (Teacher)session.getAttribute("tea");
      %>
      <a href="teacherInfo.jsp" style="margin-left: 1400px;">返回教师页面</a>
    <h1 class="text-center" style="font-size: 35px; margin-top: -30px;">申请考试</h1><br>
    <form class="form-inline" method="post" style="margin-left: 600px;" id="addTest_form">
        <label for="testid">考试编号：</label>&nbsp;&nbsp;<input type="text" name="testid" id="testid" class="form-control" placeholder="请输入数字">
            <br><br>
            <label for="tid">教师编号：</label>&nbsp;&nbsp;<input type="text" name="tid" id="tid" class="form-control" value="<%=t.getTid() %>" readonly>
            <br><br>
            <label for="testtime">考试时间：</label>&nbsp;&nbsp;<input type="text" name="testtime" id="testtime"  class="form-control" placeholder="请输入年/月/日 h:min-h:min">
            <br><br>
            <label for="courseid">科目编号：</label>&nbsp;&nbsp;<input type="text" name="courseid" id="courseid" class="form-control"  placeholder="请输入科目编号">
            <br><br>
            <label for="classid">班级编号：</label>&nbsp;&nbsp;<input type="text" name="classid" id="classid" class="form-control" placeholder="请输入班级编号">
            <br><br>
            <label for="istestfinish">申请状态：</label>&nbsp;&nbsp;<input type="text" name="istestfinish" id="istestfinish" class="form-control"  value="0"  readonly>
            <br>
            <p style="margin-left: -30px;">请先点击提交考试，再点击发送考试！！！</p>
            <br>
            <button type="button" style="background-color: #0066cc;color: #ffffff;width: 100px; margin-left:20px; border-radius: 4px 4px 4px 4px;" id="btn_addtest">提交考试</button>   
            <a type="button" href="ats" style="display: block;background-color: #0066cc;color: #ffffff;width: 100px; height: 30px; margin-left: 150px; margin-top: -30px;border-radius: 4px 4px 4px 4px; text-align: center; font-size: 13px;" >发送考试</a>
    </form>
    <br>
    <form action="sats">
        <label for="tid"></label>
        <input type="hidden" id="tid" name="tid" class="form-control" value="<%=t.getTid() %>" > &nbsp;
        <button id="btn_searchList" class="btn btn-sm btn-primary" style="background-color: #0066cc;color: #ffffff;width: 250px; margin-left: 600px;margin-top: -10px; border-radius: 4px 4px 4px 4px; font-size: 13px;">查询申请考试列表</button>
    </form>
    </body>
</html>
